package org.tacademy.homework6;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class DrugsItemView extends LinearLayout {
	
	private ImageView mIcon;
	private TextView mText01;

	public DrugsItemView(Context context) {
		super(context);
	}
	
	public DrugsItemView(Context context, DrugsItem aItem) {
		super(context);
		
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.customer, this, true);
		
		mIcon = (ImageView)findViewById(R.id.drug_icon);
		mIcon.setImageDrawable(aItem.getmIcon());
		
		mText01 = (TextView)findViewById(R.id.textView);
		mText01.setText(aItem.getDname());
	}
	
	public void setIcon(Drawable icon){
		mIcon.setImageDrawable(icon);
	}
	
	public void setText(int index, String data){
		if(index == 0)
			mText01.setText(data);
	}

}
